home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / intrcpt.arc / INTRCPTX.ASM < prev   
Assembly Source File  |  1986-05-05  |  5KB  |  290 lines

  1. code    segment para
  2.     assume cs:code,ds:code
  3.     org 100h
  4. intrcpt    proc far
  5.     jmp    init
  6. test    db    0           ;Drive to intercept on
  7. got    db    0        ;Drive being accessed
  8. got1    db    0        ;The second character ( normally : )
  9.     even
  10. temp    dw    0
  11. x40off    dw    0        ;Offset for INT 40H
  12. x40seg    dw    0        ;Segment of INT 40H
  13. x2foff    dw    0        ;Offset for INT 2FH
  14. x2fseg    dw    0        ;Segment for INT F1H
  15. x21off    dw    0        ;Offset for INT 21H
  16. x21seg    dw    0        ;Segment for INT 21H
  17. flag    dw    0        ; Operation flag
  18. ;
  19. ;    Interrupt 21H Code
  20. ;
  21. x21int:    push    ax
  22.     push    bx
  23.     push    cx
  24.     push    dx
  25.     push    ds
  26.     mov    dx,cs
  27.     mov    ds,dx
  28.     cmp    ax,440dh    ;Secret IOCTL!
  29.     je    x211
  30.     jmp    x21out
  31. ;
  32. x211:    mov    al,test        ;Convert letter to drive number
  33.     sub    al,96
  34.     cmp    al,bl        ;Is this for the proper drive?
  35.     jne    x21out         ;No
  36.     mov    ax,40h        ;Address of Diskette State Machine
  37.     mov    ds,ax
  38.     mov    bx,90h
  39. xb:    mov    al,54h        ;Set the STATE for Quad/FM/Single step
  40.     mov    ds:[bx],al    ;Store it away to FOOL the BIOS
  41.     mov    cs:flag,1    ;Set the operation to bypass INT40H check
  42.     push    ax
  43.     push    bx
  44.     push    cx
  45.     push    dx
  46.     push    es
  47.     push    ds
  48.     push    si
  49.     mov    ax,cs        ;Do a VERIFY to the last recorded cyl
  50.     mov    ds,ax        ;So that all will be well within the BIOS
  51.     mov    es,ax     ;This is necessay for DISKCOPY and
  52. xa:    lea    bx,temp        ;DISKCOMP to work
  53.     mov    cl,1
  54.     mov    dx,40h
  55.     mov    si,94h
  56.     push    ds
  57.     mov    ds,dx
  58.     mov    ch,ds:[si]
  59.     pop    ds
  60.     mov    ah,4
  61.     mov    al,1
  62.     xor    dx,dx
  63.     int    40h        ;The actual VERIFY operation
  64. xaout:    xor    ax,ax
  65.     mov    cs:flag,ax
  66.     pop    si
  67.     pop    ds
  68.     pop    es
  69.     pop    dx
  70.     pop    cx
  71.     pop    bx
  72.     pop    ax
  73. ;
  74. ;
  75.     mov    al,54h
  76.     mov    ds:[bx],al ;Reload the STATE MACHINE to be safe
  77. x21out:    pop    ds
  78.     pop    dx
  79.     pop    cx
  80.     pop    bx
  81.     pop    ax
  82.     jmp    dword ptr cs:[x21off]  ; LONG jump to the actual INT
  83. ;
  84. ;  INTERRUPT 40H code
  85. ;
  86. x40int:    push    ax
  87.     push    bx
  88.     push    cx
  89.     push    dx
  90.     push    ds
  91.     pushf
  92.     mov    ax,cs
  93.     mov    ds,ax
  94.     cmp    flag,1         ;Is this a special operation from the
  95.     je    x2         ;INT 21H service routine?
  96.     mov    ah,'a'        ;Are we back to DRIVE A?
  97.     mov    al,got
  98.     cmp    ah,al
  99.     jne    x1        ;Yes, if a colon follows
  100.     mov    ah,':'
  101.     mov    al,got1
  102.     cmp    ah,al
  103.     jne    x2        ;Is it A: ?
  104.     mov    ax,40h
  105.     mov    bx,90h
  106.     mov    ds,ax
  107.     mov    dl,ds:[bx]
  108.     mov    dh,0f0h
  109.     and    dl,dh
  110.     cmp    dl,50h         ;If it's 5X then set 61H in STATE
  111.     jne    x2         ;Machine
  112.     mov    dl,61h
  113.     mov    ds:[bx],dl
  114. x2:    jmp    x40out
  115. x1:    mov    ah,test        ;Are we talking to the correct drive?
  116.     mov    al,got
  117.     cmp    ah,al
  118.     jne    x40out        ;Not the proper drive letter
  119.     mov    ah,':'
  120.     mov    al,got1
  121.     cmp    ah,al
  122.     jne    x40out        ;No colon
  123.     mov    dl,0dfh        ;The single step mask
  124.     mov    ax,40h        ;Segment
  125.     mov    ds,ax
  126.     mov    bx,90h        ;40:90 is the address
  127.     mov    dh,ds:[bx]
  128.     and    dh,dl        ;Mask out the double step bit
  129.     mov    ds:[bx],dh    ;Store it back
  130. x40out:    popf
  131.     pop    ds
  132.     pop    dx
  133.     pop    cx
  134.     pop    bx
  135.     pop    ax
  136.     jmp    dword ptr cs:[x40off]    ;Do the REAL INT 40H
  137. ;
  138. ;  Interrupt 2Fh
  139. ;
  140. x2fint:    push    ax
  141.     push    bx
  142.     push    cx
  143.     push    dx
  144.     push    ds
  145.     pushf
  146.      cmp    ah,17     ;Is it the proper 2F Function?
  147.      jne    x2fout        ;No
  148.     cmp    al,35
  149.     jne    x2fout
  150.     mov    bx,ds:[si]    ;SECRET STUFF!
  151.     mov    ax,cs
  152.     mov    ds,ax
  153.     cmp    bh,':'
  154.     jne    x2fout
  155.     cmp    bl,90
  156.     ja    x2f1
  157.     mov    ch,bh
  158.     xor    bh,bh
  159.     add    bx,32
  160.     mov    bh,ch
  161. x2f1:    mov    got,bl
  162.     mov    got1,bh
  163. x2fout:    popf
  164.     pop    ds
  165.     pop    dx
  166.     pop    cx
  167.     pop    bx
  168.     pop    ax
  169.     jmp    dword ptr cs:[x2foff]    ;Continue the 2F chain
  170.     dw    0
  171. table    dw    0
  172. init:    push    es
  173.     mov    ax,0ffffh
  174.     mov    es,ax
  175.     mov    bx,0eh
  176.     mov    al,es:[bx]    ;Check to see if this is an AT
  177.     cmp    al,0fch        ;AT code
  178.     je    ini1
  179.     mov    ah,9
  180.     lea    dx,messat
  181.     int    21h
  182.     xor    ax,ax
  183.     int    21h
  184. ini1:    mov    ah,30h
  185.     int    21h        ;Check for proper DOS
  186.     cmp    al,3
  187.     jae    i1
  188.     jmp    badv
  189. i1:    cmp    ah,14
  190.     jae    i2
  191. badv:    mov    ah,9
  192.     lea    dx,messv
  193.     int    21h
  194.     xor    ax,ax
  195.     int    21h
  196. i2:    mov    al,10h
  197.     out    70h,al        ;Check to see if drive A is 1.2 megger
  198.     in    al,71h
  199.     mov    ah,0f0h        ;Mask
  200.     and    al,ah
  201.     cmp    al,20h
  202.     je    i3        ;Yes it is a 1.2 megabyte floppy drive
  203.     lea    dx,messd
  204.     mov    ah,9
  205.     int    21h
  206.     xor    ax,ax
  207.     int    21h
  208. i3:    mov    bx,80h        ;PSP address
  209.     mov    al,[bx]        ;Byte count
  210.     cmp    al,0
  211.     jne    i5
  212. i4:    mov    ah,9
  213.     lea    dx,messn
  214.     int    21h
  215.     xor    ax,ax
  216.     int    21h
  217. i5:    inc    bx
  218.     mov    al,[bx]
  219.     cmp    al,32
  220.     je    i5
  221.     cmp    al,13
  222.     je    i4
  223.     cmp    al,90
  224.     ja    i6
  225.     xor    ah,ah
  226.     add    ax,32
  227. i6:    cmp    al,100
  228.     jb    i7
  229.     cmp    al,122
  230.     ja    i7
  231.     jmp    i8
  232. i7:    mov    ah,9
  233.     lea    dx,messp
  234.     int    21h
  235.     xor    ax,ax
  236.     int    21h
  237. i8:    mov    test,al
  238.     cli            ;Start the vector swapping
  239.     mov    cx,cs
  240.     xor    ax,ax
  241.     mov    flag,ax
  242.     mov    es,ax
  243.     mov    bx,256        ;INT40H
  244.     mov    ax,es:[bx]
  245.     mov    x40off,ax
  246.     mov    ax,offset x40int
  247.     mov    es:[bx],ax
  248.     add    bx,2
  249.     mov    ax,es:[bx]
  250.     mov    x40seg,ax
  251.     mov    es:[bx],cx
  252.     mov    bx,188        ;INT2F
  253.     mov    ax,es:[bx]
  254.     mov    x2foff,ax
  255.     mov    ax,offset x2fint
  256.     mov    es:[bx],ax
  257.     add    bx,2
  258.     mov    ax,es:[bx]
  259.     mov    x2fseg,ax
  260.     mov    es:[bx],cx
  261.     mov    bx,132        ;INT21
  262.     mov    ax,es:[bx]
  263.     mov    x21off,ax
  264.     mov    ax,offset x21int
  265.     mov    es:[bx],ax
  266.     add    bx,2
  267.     mov    ax,es:[bx]
  268.     mov    x21seg,ax
  269.     mov    es:[bx],cx
  270.     sti            ;Vectors are swapped
  271.     mov    ah,9
  272.     lea    dx,messg
  273.     int    21h
  274.     mov    dx,offset table    ;All that has to be resident
  275.     int    27h        ;Stay resident
  276. messat    db    'The computer is NOT an IBM-AT',13,10,'$'
  277. messv    db    'Wrong DOS Version ---- Must be 3.2 or above'
  278.     db    13,10,'$'
  279. messd    db    'Drive A is NOT a high capacity drive'
  280.     db    13,10,'$'
  281. messn    db    'Requires NEW drive letter that DRIVER.SYS '
  282.     db    'generated',13,10,'$'
  283. messp    db    'Invalid drive specifier'
  284.     db    13,10,'$'
  285. messg    db    'Alpha Computer Service INTERCEPT is now loaded'
  286.     db    13,10,'$'
  287. intrcpt    endp
  288. code    ends
  289.     end    intrcpt
  290.